package com.hz.friends.fragment;


import android.app.Fragment;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;

import com.hz.friends.activity.R;

public class MuserInfosFragment extends Fragment{
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(R.layout.muserinfos, null);
	}

	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		setView();
		initView();
	}

	private void setView() {
		ImageButton imbtn_gift1 = (ImageButton)getView().findViewById(R.id.imbtn_gift1);
		ImageButton imbtn_gift2 = (ImageButton)getView().findViewById(R.id.imbtn_gift2);
		ImageButton imbtn_gift3 = (ImageButton)getView().findViewById(R.id.imbtn_gift3);
		ImageButton imbtn_gift4 = (ImageButton)getView().findViewById(R.id.imbtn_gift4);
		ImageButton imbtn_pic1 = (ImageButton)getView().findViewById(R.id.imbtn_pic1);
		ImageButton imbtn_pic2 = (ImageButton)getView().findViewById(R.id.imbtn_pic2);
		ImageButton imbtn_pic3 = (ImageButton)getView().findViewById(R.id.imbtn_pic3);
		ImageButton imbtn_pic4 = (ImageButton)getView().findViewById(R.id.imbtn_pic4);
		ImageButton imbtn_pic5 = (ImageButton)getView().findViewById(R.id.imbtn_pic5);
		ImageButton imbtn_pic6 = (ImageButton)getView().findViewById(R.id.imbtn_pic6);
		ImageButton imbtn_pic7 = (ImageButton)getView().findViewById(R.id.imbtn_pic7);
		ImageButton imbtn_pic8 = (ImageButton)getView().findViewById(R.id.imbtn_pic8);
		
		int margin = (int) TypedValue.applyDimension(
				TypedValue.COMPLEX_UNIT_DIP, 8, getResources()
						.getDisplayMetrics());
		DisplayMetrics metric = new DisplayMetrics();
		getActivity().getWindowManager().getDefaultDisplay().getMetrics(metric);
		int mScreenWidth = metric.widthPixels;
		int widthAndHeight = (mScreenWidth - margin * 5) / 4;
		LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(widthAndHeight, widthAndHeight);
		imbtn_gift1.setLayoutParams(params);
		imbtn_gift2.setLayoutParams(params);
		imbtn_gift3.setLayoutParams(params);
		imbtn_gift4.setLayoutParams(params);
		imbtn_pic1.setLayoutParams(params);
		imbtn_pic2.setLayoutParams(params);
		imbtn_pic3.setLayoutParams(params);
		imbtn_pic4.setLayoutParams(params);
		imbtn_pic5.setLayoutParams(params);
		imbtn_pic6.setLayoutParams(params);
		imbtn_pic7.setLayoutParams(params);
		imbtn_pic8.setLayoutParams(params);
		
	}
	private void initView() {
		
	}
	@Override
	public void onResume() {
		super.onResume();
	}
}
